@using BlazorApp.Pages.Common
@using Entity.Crd.Gateway
@using k8s.Models
@using Mapster
@inherits BlazorApp.Pages.Common.PageBase
@if (Status is { Count: > 0 })
{
    <GridRow Class="grid-table">
        <GridCol Span="5">@L["Name"]</GridCol>
        <GridCol Span="4">@L["Attached"]</GridCol>
        <GridCol Span="4">@L["Support"]</GridCol>
        <GridCol Span="11">@L["Condition"]</GridCol>
    </GridRow>
    foreach (var listener in Status)
    {
        <GridRow Class="grid-table">
            <GridCol Span="5">
                <ColorfulTag>@listener.Name</ColorfulTag>
            </GridCol>
            <GridCol Span="4">
                <ColorfulTag>@listener.AttachedRoutes</ColorfulTag>
            </GridCol>
            <GridCol Span="4">
                @if (listener.SupportedKinds is { Count: > 0 })
                {
                    foreach (var kind in listener.SupportedKinds)
                    {
                        <ColorfulTag>@kind.Kind</ColorfulTag>
                    }
                }
            </GridCol>
            <GridCol Span="11">
                <ConditionsTagView
                    Conditions="@(listener.Conditions.Adapt<IList<V1Condition>>())">
                </ConditionsTagView>
            </GridCol>
        </GridRow>
    }
}

@code {
    [Parameter] public IList<ListenerStatus> Status { get; set; }
}
